# -*- coding: utf-8 -*-
"""
Created on Tue Jun  5 21:16:41 2018

@author: Administrator
"""

#%%
#%%
from agilepipe.spine import AgilePipe

#the code below is used to process T1
modality = '_T1'     #'_T1' '_BOLD' '_CBF'  '_PET'
manipulate_methods = {   'Spm_reslice_SR':{},
                        'Greater_dot5_GD5':{}
                      }
#dirpath 也是一个dict，其keys与manipulate_methods完全相同，但元素是对应处理方法所生成的文件夹的名字。
dirpath_dict = {'original_dirpath':[],
                       #用来存放其实的文件。
                       'Spm_reslice_SR':[],
                       'Greater_dot5_GD5':[]
                    }


#agile_pipe()用ccs处理BOLD的测试代码
original_dirpath = r'/media/root/Elements4/XuanWu_last/mask/Stanford_altas/Stanford'
#the first element of dirpath_list is very important which is used as deformation field 
#the second element of dirpath_list can be used in the reslice processing as the "Image Defining Space" filepath
dirpath_list = [r'/media/root/Elements4/XuanWu_dpabi_spm/CBF_processing_ag/T1_SC_SS','/root/Documents/BrainMask_05_61x73x61.nii',''] #即使没有用也要赋值，否则会报错
dirpath_dict = dirpath_dict
manipulate_methods = manipulate_methods
parallel_core = 0.7
AgilePipe(modality,original_dirpath,dirpath_list,dirpath_dict,manipulate_methods,parallel_core)

#%%
from agilepipe.process.mask import Intersect_2mask

mask1_dirpath = r'/media/root/Elements4/XuanWu_last/mask/GM_mask/intersect_mask/T1_SC_SS_GM_SN_SR_LM-0.9/tm_groupmask'

mask2_dirpath = r'/media/root/Elements4/XuanWu_last/mask/Stanford_altas/Stanford_SR_GD5'

#output_dirpath = r'/media/root/Elements4/XuanWu_last/mask/Stanford_altas'
Intersect_2mask([mask1_dirpath,mask2_dirpath])

#%%
